Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

interface System.​Collections.​Generic.​ICollection<​T>

Assembly: System.Runtime

Implemented Interfaces

Defines methods to manipulate generic collections.

Properties

int
Count
Gets the number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1" /> .
bool
IsReadOnly
Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only.

Methods

void
Add​(T item)
Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1" /> .
item The object to add to the <see cref="T:System.Collections.Generic.ICollection`1" /> .
void
Clear​()
Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1" /> .
bool
Contains​(T item)
Determines whether the <see cref="T:System.Collections.Generic.ICollection`1" /> contains a specific value.
Returns <see langword="true" /> if <paramref name="item" /> is found in the <see cref="T:System.Collections.Generic.ICollection`1" /> ; otherwise, <see langword="false" /> .
item The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1" /> .
void
CopyTo​(T[] array, int arrayIndex)
Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1" /> to an <see cref="T:System.Array" /> , starting at a particular <see cref="T:System.Array" /> index.
array The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.ICollection`1" /> . The <see cref="T:System.Array" /> must have zero-based indexing.
arrayIndex The zero-based index in <paramref name="array" /> at which copying begins.
bool
Remove​(T item)
Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1" /> .
Returns <see langword="true" /> if <paramref name="item" /> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1" /> ; otherwise, <see langword="false" /> . This method also returns <see langword="false" /> if <paramref name="item" /> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1" /> .
item The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1" /> .